//
//  SKYCrashModel.m
//  SkyonSDK
//
//  Created by 张二帅 on 2018/5/16.
//  Copyright © 2018年 Skyon. All rights reserved.
//

#import "SKYCrashModel.h"




@implementation SKYCrashMemoryModel

@end


@implementation SKYCrashSystemModel

@end

static NSDateFormatter *sky_crashDateFormatter;

@implementation SKYCrashReportModel

+ (void) initialize {
    sky_crashDateFormatter = [[NSDateFormatter alloc] init];
    [sky_crashDateFormatter setLocale:[NSLocale localeWithLocaleIdentifier:@"en_US_POSIX"]];
    [sky_crashDateFormatter setDateFormat:@"yyyy'-'MM'-'dd'T'HH':'mm':'ss'Z'"];
    [sky_crashDateFormatter setTimeZone:[NSTimeZone timeZoneForSecondsFromGMT:0]];
}

/**
 当 JSON 转为 Model 完成后，该方法会被调用。
 */
- (BOOL)modelCustomTransformFromDictionary:(NSDictionary *)dic {
    NSString *crashTime = dic[@"timestamp"];
    if (crashTime == nil || ![crashTime isKindOfClass:[NSString class]]) {
        return NO;
    }
    _timestamp = [SKYCrashReportModel dateFromString:crashTime];
    return YES;
}

+ (NSDate *)dateFromString:(NSString *)dateString {
    if (dateString.length > 0) {
        return [sky_crashDateFormatter dateFromString:dateString];
    }
    return nil;
}

@end


@implementation SKYCrashDetailModel

@end


@implementation SKYCrashUserModel

@end


@implementation SKYCrashModel

@end
